package com.econ.powercloud.ems.common.enums;

/**
 * 电价模型特殊情况枚举
 */
public enum ConditionType implements EnumMethod {

    GT(1,"大于"),
    LT(2,"小于"),
    EQUAL(3,"等于"),
    GTE(4,"大于等于"),
    LTE(5,"小于等于"),
    ;

    private Integer code;
    private String desc;

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getDesc() {
        return desc;
    }

    ConditionType(int code, String desc){
        this.code=code;
        this.desc=desc;
    }

    public static ConditionType fromCode(int code){
        for(ConditionType type: ConditionType.values()){
            if(type.getCode() == code){
                return type;
            }
        }
        return null;
    }

    public static String getDescFromCode(int code){
        for(ConditionType type: ConditionType.values()){
            if(type.getCode() == code){
                return type.getDesc();
            }
        }
        return null;
    }
}
